<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .big {
      width: 200px;
      height: 200px;
      background-color: red;
    }
    .mid {
      width: 150px;
      height: 150px;
      background-color: blue;
    }
    .small {
      width: 100px;
      height: 100px;
      background-color: green;
    }
  </style>
</head>
<body>
  <div id="app">
    <p>修饰符：通过简单的语法实现一个小的功能</p>
    <p>事件修饰符</p>
    <!-- 事件流 -->
    <p>1.stop阻止冒泡</p>
    <div class="big" @click="show('big')">
      <div class="mid" @click.stop="show('mid')">
        <div class="small" @click="show('small')"></div>
      </div>
    </div>
    <hr>
    <p>2.prevent 阻止默认事件</p>
    <a href="./学生信息登记表.html" @click.prevent="jump">学生信息登记表</a>
    <p @contextmenu.prevent="showMenu">右键显示菜单</p>
    <hr>
    <p>3.capture优先执行-将事件的执行顺序改为捕获</p>
    <div class="big" @click.capture="show('big')">
      <div class="mid" @click="show('mid')">
        <div class="small" @click="show('small')"></div>
      </div>
    </div>
    <p>4. once只会响应一次</p>
    <button @click.once="submit">提交</button>
    <p>5.self:自己的事件只能由自己触发，不能被其他元素触发</p>
    <div class="big" @click.self="show('big')">
      <div class="mid" @click="show('mid')">
        <div class="small" @click="show('small')"></div>
      </div>
    </div>
  </div>
  <script src="../vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {

      },
      methods: {
        show(arg) {
          console.log(arg);
        },
        jump() {
          console.log(123);
        },
        showMenu() {
          console.log('不显示菜单');
        },
        submit() {
          console.log('我提交了');
        }
      },
    })
  </script>
</body>
</html>